{extend name="public/base"/}
{block name="body"}
<!--修改了368-385的弹出窗口-->

<div class="hdcom">
  <header class="mui-bar mui-bar-nav" style="z-index:7">
  			<h1 class="mui-title">{$title}</h1>
        <a class="mui-icon mui-icon-contact mui-pull-right" href="{:url('index/user/index')}"></a>
  </header>
  <div class="pref-info" style="left: 0px; right: 0px; top: 44px; z-index: 7;position: fixed;">
      <!--<span class="pref-text">{:get_table_field('1','id', 'content', 'Page')}</span>--><span class="pref-text">{$notify}</span><span class="pref-text">客服的微信：15885108322</span>
  </div>

  <div class="zcnav">
   <div   class="cnavcom">
   				<div class="mui-card-content">
   					<div class="mui-card-content-inner" style="padding: 2px 0;overflow: hidden;">
             <!-- <a  href="#content" class=" catnav ">推荐商品</a>-->
               {volist name="Goodscatlist"  id="vo"}
                 <a  href="#content{$vo.id}" class=" catnav {eq name='$vo.id' value='$cat_id'}catactive{/eq}">{$vo.cat_name}</a>
               {/volist}
   					</div>
   				</div>
   	</div>
  </div>

</div>

<div class="mui-content mui-row avoidContentHidden" style="padding-bottom: 50px;">


  <a class="anchor anchor_fixed" id="content"></a>
    <div>
     <!--  <dl >
        <dt>
            <div class="category-title">
                <strong class="category-name">推荐商品</strong>
                <span class="category-description"></span>
            </div>
        </dt>
        {volist name="$TjList" id="item"}
          <dd  data-ruleid="{$item['goodsrule'][0]['id']}"  data-goodid="{$item['id']}" style="padding-bottom: 0;">
              <span class="foodimg" style="    flex: 7;"><img  src="{$item['cover_id']|get_cover='path','400x218'}" style="height:120px;" data-preview-src="" data-preview-group="{$item['id']}">

                (点击图片放大缩小图片)
              </span>
              <section class="foodinfo" style="    padding: 0;"   >
                  <div onclick='javascript:window.location.href="{:url($detailUrl,['id'=>$item['id']])}"' >
                    <header class="foodtitle" ><span>{$item['good_name']}{eq name="$item.is_timelimit" value="1"}<span style="color:red">(限时团购)</span>
                      {/eq}</span>
                    </header>
                    <!-- <p class="mui-ellipsis fooddescription" style="margin:3px 0;">商家:{$item['shop_id']|get_table_field="id","shopname","goodshops"}</p> -->


                 <!--    <p class="fooddescription"  style="margin:3px 0;font-weight: bold;color:red;">配送说明:
                      {eq name="$item.isshowdelivery" value="1"}
                        {$item['deliverydec']}
                      {else \}
                        {:config('jspsdec')}
                      {/eq}

                      </p>
                      {eq name="$item.is_timelimit" value="1"}
                        {if condition="strtotime($item->startlimit) < intval(time()) && intval(time()) < strtotime($item->endlimit)"}
                          <p class="fooddescription endlimit"   data-endtime = "{$item.endlimit}" data-starttime = "{$item.startlimit}"  style="margin:3px 0;font-weight: bold;"></p>
                        {elseif condition="strtotime($item->startlimit) > intval(time())"/}
                        <p class="fooddescription  hidecartbtn" data-id="{$item.id}"   style="margin:3px 0;color:red">团购未开始：{$item.startlimit} —— {$item.endlimit}</p>
                        {else /}
                        <p class="fooddescription  hidecartbtn" data-id="{$item.id}"  style="margin:3px 0;color:red">团购已结束：{$item.startlimit} —— {$item.endlimit}</p>
                        {/if}
                      {/eq}
                      <p class="fooddescription"  style="    margin: 0 0 40px 0;color:#000;font-weight: bold;">特色描述:{$item['good_desc']} <br />
                        {neq name="$item['goodsrule'][0]['quota']" value='0'}
                            限购：{$item['goodsrule'][0]['quota']}份
                        {/neq}


                      </p>


                    {php}
                       $priceArr = array();
                       foreach($item['goodsrule'] as $data){
                          $priceArr[]= $data['rule_price'];
                       }
                       $minPrice = min($priceArr);
                       if(count($priceArr) > 1){
                            $minPriceHtml = "<span>".$minPrice."</span><span class='foodprice-lowest'>起</span>";
                       }else{
                          $minPriceHtml = "<span>".$minPrice."</span>";
                       }
                    {/php}



                    {if condition="groupModel() gt 0"}
                        <strong class="foodprice" style="bottom: 10px;">{$minPriceHtml}  </strong>
                    {else /}
                    <strong class="foodprice" style="bottom: 10px;">{$minPriceHtml} </strong>
                    {/if}


                  </div>
                  <div class="mask mask-transition" style="display:none;">
                      <div class="wrap">
                          <div class="container">
                              <div class="specpanel">
                                  <h1>{$item['good_name']}</h1>
                                  <div class="candidators">
                                      <div class="candidators-group">
                                          <h2>规格</h2>
                                            {volist name="$item['goodsrule']" id="voo"  }
                                              <a href="javascript:" class="candidator {eq name='$i' value='1'}selected {/eq}" data-info="{$voo[rule_name]}|{$voo[rule_price]}|{$voo[stock]}|{$voo[weight]}" data-ruleid="{$voo[id]}">{$voo[rule_name]}</a>
                                            {/volist}
                                      </div>
                                      <div class="selectedresult">
                                          <p class="selectedstr">已选：{$item['goodsrule'][0]['rule_name']} <span class='stock'>库存：{$item['goodsrule'][0]['stock']}</span> <span class='weight'>重量：{$item['goodsrule'][0]['weight']}</span></p>
                                          <p class="price"><span class="yen">¥</span> <span class="now">{$item['goodsrule'][0]['rule_price']}</span> </p>
                                      </div>
                                      <a href="javascript:" class="cartadd" data-id="{$item['id']}" data-ruleid="{$item['goodsrule'][0]['id']}" data-dismiss="cart" data-methods="addmore" >加入购物车</a>
                                      <a href="javascript:" class="close"></a>
                              </div>
                          </div>
                      </div>
                  </div>
                </div>
                    <div class="cartbutton" style="    bottom: 5px;">
                      <span>
                        <span class="entitybutton">
                          {$item['id']|getRulenumhtml}
                          {if condition="count($item['goodsrule']) gt 1 "}



                            {assign name="yjs" value="0" /}
                            {foreach $item.goodsrule as $vo}
                                  {eq name ="$vo.stock" value="0"}
                                        {assign name="yjs" value="1" /}
                                  {/eq}
                              {/foreach}
                              {eq name="yjs" value="1"}
                                <a href="javascript:"  ><span class="entityspecbutton" style="background-color: #ce4747;">已售罄</span></a>
                                {else/}
                                <a href="javascript:" class="specadd cartbtn{$item['id']}"  ><span class="entityspecbutton"  >选规格</span></a>
                              {/eq}





                          {else /}
                            {eq name="$item.goodsrule[0]['stock']" value="0"}
                                  <a href="javascript:"  ><span class="entityspecbutton" style="background-color: #ce4747;">已售罄</span></a>
                            {else/}
                              <a href="javascript:" class="oneaddcart cartbtn{$item['id']}" data-dismiss="cart" data-methods="addone" ><span class="mui-icon mui-icon-plus"></span></a>
                            {/eq}
                          {/if}
                        </span>
                      </span>
                  </div>




              </section>



          </dd>

        {/volist}
      </dl>
    </div>-->





















    {volist name="Goodscatlist"  id="vo"}
    <a class="anchor anchor_fixed" id="content{$vo.id}"></a>
    <div>
      <dl >
        <dt>
            <div class="category-title">
                <strong class="category-name">{$vo.cat_name}</strong>
                <span class="category-description"></span>
            </div>
        </dt>
        {volist name=":getGoodscat($vo['id'])" id="item"}
          <dd  data-ruleid="{$item['goodsrule'][0]['id']}"  data-goodid="{$item['id']}" style="padding-bottom: 0;">
              <span class="foodimg" style="    flex: 7;"><img  src="{$item['cover_id']|get_cover='path','400x218'}" style="height:120px;" data-preview-src="" data-preview-group="{$item['id']}">

                (点击图片放大缩小图片)
              </span>
              <section class="foodinfo" style="    padding: 0;"   >
                  <div onclick='javascript:window.location.href="{:url($detailUrl,['id'=>$item['id']])}"' >
                    <header class="foodtitle" ><span>{$item['good_name']}{eq name="$item.is_timelimit" value="1"}<span style="color:red">(限时团购)</span>
                      {/eq}</span>
                    </header>
                    <!-- <p class="mui-ellipsis fooddescription" style="margin:3px 0;">商家:{$item['shop_id']|get_table_field="id","shopname","goodshops"}</p> -->


                   <p class="fooddescription"  style="margin:3px 0;font-weight: bold;color:red;">                   	<!--配送说明11:
                      {eq name="$item.isshowdelivery" value="1"}
                        {$item['deliverydec']}
                      {else \}
                        {:config('jspsdec')}
                      {/eq}-->

                      </p>
                      {eq name="$item.is_timelimit" value="1"}
                        {if condition="strtotime($item->startlimit) < intval(time()) && intval(time()) < strtotime($item->endlimit)"}
                          <p class="fooddescription endlimit"   data-endtime = "{$item.endlimit}" data-starttime = "{$item.startlimit}"  style="margin:3px 0;font-weight: bold;"></p>
                        {elseif condition="strtotime($item->startlimit) > intval(time())"/}
                        <p class="fooddescription  hidecartbtn" data-id="{$item.id}"   style="margin:3px 0;color:red">团购未开始：{$item.startlimit} —— {$item.endlimit}</p>
                        {else /}
                        <p class="fooddescription  hidecartbtn" data-id="{$item.id}"  style="margin:3px 0;color:red">团购已结束：{$item.startlimit} —— {$item.endlimit}</p>
                        {/if}
                      {/eq}
                      <p class="fooddescription"  style="    margin: 0 0 40px 0;color:#000;font-weight: bold;">特色描述:{$item['good_desc']} <br />
                        {neq name="$item['goodsrule'][0]['quota']" value='0'}
                            限购：{$item['goodsrule'][0]['quota']}份
                        {/neq}


                      </p>


                    {php}
                       $priceArr = array();
                       foreach($item['goodsrule'] as $data){
                          $priceArr[]= $data['rule_price'];
                       }
                       $minPrice = min($priceArr);
                       if(count($priceArr) > 1){
                            $minPriceHtml = "<span>".$minPrice."</span><span class='foodprice-lowest'>起</span>";
                       }else{
                          $minPriceHtml = "<span>".$minPrice."</span>";
                       }
                    {/php}



                    {if condition="groupModel() gt 0"}
                        <strong class="foodprice" style="bottom: 10px;">{$minPriceHtml}  </strong>
                    {else /}
                    <strong class="foodprice" style="bottom: 10px;">{$minPriceHtml} </strong>
                    {/if}


                  </div>
                  <div class="mask mask-transition" style="display:none;">
                      <div class="wrap">
                          <div class="container">
                              <div class="specpanel">
                                  <h1>{$item['good_name']}</h1>
                                  <div class="candidators">
                                      <div class="candidators-group">
                                          <h2>规格</h2>
                                            {volist name="$item['goodsrule']" id="voo"  }
                                              <a href="javascript:" class="candidator {eq name='$i' value='1'}selected {/eq}" data-info="{$voo[rule_name]}|{$voo[rule_price]}|{$voo[stock]}|{$voo[weight]}" data-ruleid="{$voo[id]}">{$voo[rule_name]}</a>
                                            {/volist}
                                      </div>
                                      <div class="selectedresult">
                                          <p class="selectedstr">已选：{$item['goodsrule'][0]['rule_name']} <span class='stock'>库存：{$item['goodsrule'][0]['stock']}</span> <span class='weight'>重量：{$item['goodsrule'][0]['weight']}</span></p>
                                          <p class="price"><span class="yen">¥</span> <span class="now">{$item['goodsrule'][0]['rule_price']}</span> </p>
                                      </div>
                                      <a href="javascript:" class="cartadd" data-id="{$item['id']}" data-ruleid="{$item['goodsrule'][0]['id']}" data-dismiss="cart" data-methods="addmore" >加入购物车</a>
                                      <a href="javascript:" class="close"></a>
                              </div>
                          </div>
                      </div>
                  </div>
                </div>
                    <div class="cartbutton" style="    bottom: 5px;">
                      <span>
                        <span class="entitybutton">
                          {$item['id']|getRulenumhtml}
                          {if condition="count($item['goodsrule']) gt 1 "}



                            {assign name="yjs" value="0" /}
                            {foreach $item.goodsrule as $vo}
                                  {eq name ="$vo.stock" value="0"}
                                        {assign name="yjs" value="1" /}
                                  {/eq}
                              {/foreach}
                              {eq name="yjs" value="1"}
                                <a href="javascript:"  ><span class="entityspecbutton" style="background-color: #ce4747;">已售罄</span></a>
                                {else/}
                                <a href="javascript:" class="specadd cartbtn{$item['id']}"  ><span class="entityspecbutton"  >选规格</span></a>
                              {/eq}





                          {else /}
                            {eq name="$item.goodsrule[0]['stock']" value="0"}
                                  <a href="javascript:"  ><span class="entityspecbutton" style="background-color: #ce4747;">已售罄</span></a>
                            {else/}
                              <a href="javascript:" class="oneaddcart cartbtn{$item['id']}" data-dismiss="cart" data-methods="addone" ><span class="mui-icon mui-icon-plus"></span></a>
                            {/eq}
                          {/if}
                        </span>
                      </span>
                  </div>




              </section>



          </dd>

        {/volist}
      </dl>
    </div>

    {/volist}

</div>

{include file="public/cartNav" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/ext.css?v1111">
{/block}
{block name="script"}
<script type="text/javascript">
  var addUrl = "{:url('index/cart/add')}",
      minusUrl = "{:url('index/cart/minus')}",
      clearUrl="{:url('index/cart/clear')}",
      cartListUrl ="{:url('index/cart/getCartlist')}";
</script>


<script src="__PUBLIC__/xsd/js/cart.js?v=1" charset="utf-8"></script>
<script>
  $(function(){
    var hei = $('header').height()+$('.pref-info').height()+$('.cnavcom').height();

      hei = hei+'px'
      $('.avoidContentHidden').css({'margin-top': hei})
      $('.anchor_fixed').css({'top': '-'+hei})

    $(document).on('click', '.tgxd' , function(){
      var url = $(this).attr('data-url'),num = parseInt($('[data-dismiss="cartpopup"]').attr('attr-quantity'))
      var subscribe = '{$subscribe}';
      if(subscribe != 1){
        $.get("{:url('index/getSubscribe')}", function(data){
          if(data.value == 0){
            mui.alert('<img src="/public/images/qrcode_for_wx.jpg" style="width:100%;"><p style=" text-align: left;"><b>无法识别二维码</b><br />1、打开微信，点击‘添加朋友’<br />2、点击公众号<br />3、搜索公众号：贵阳鲜果屋<br />4、点击‘关注’，完成</p>', '请长按扫二维码关注公众号');
            return ;
          }else {
            if(num>0){
            window.location.href = "{$cartUrl}"
            }else{
              mui.toast('请添加购买的商品！')
            }
          }
        })

      }else{
        if(num>0){
        window.location.href = "{$cartUrl}"
        }else{
          mui.toast('请添加购买的商品！')
        }
      }
    })
  })

  $(function(){
    $('.pref-info').click(function(){
      var info=$(this).text()
      mui.alert(info, '公告', '关闭',function() {});
    })
  })
</script>

{include file="public/previewimage" /}

<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"></script>

<script>

    wx.config({$wxoptions|json_encode});

    wx.error(function(e){

      	console.log(e);

      });

    wx.ready(function(){

      wx.onMenuShareTimeline({

          title: "{$title}",
          desc: "{$title},为您的家人、朋友、客户送上一份真挚的祝福", // 分享描述

          link: "",

          imgUrl: "http://www.xgw0851.com/public/images/zq.jpg",

      });

      wx.onMenuShareAppMessage({

          title: "{$title}",

          desc: "{$title},为您的家人、朋友、客户送上一份真挚的祝福", // 分享描述

          link: "",

          imgUrl: "http://www.xgw0851.com/public/images/zq.jpg",



      });

    });

</script>
{/block}
